﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using WEB.Model.Service.Sysconfig;
using WEB.Model.Entity.Accout;
using WEB.Model.Service.Posts;
using System.Data;
using WEB.Data;

namespace WEB
{
    public partial class main : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["user"] == null || Session["user"].ToString()=="")
            {
                Response.Write("<script>alert('您尚未登陆，请登陆！'); top.location.href='Login.aspx';</script>");
                Response.End();
            }
            Admin admin  = (Admin)Session["user"];
            adminUser.Text = admin.username;
            datetime.Text = DateTime.Now.ToString("yyyy年MM月dd日");
            initPosts();
        }

        protected void initPosts()
        {
            PostService ps = new PostService();
            DataTable dt = ps.nGetPosts();
            DetailsView1.DataSource = dt.DefaultView;
            DetailsView1.DataBind();
        }
    }
}